package com.example.designpattern.criteria;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: cph
 * @date: 2022/2/14 17:58
 */
public class CriteriaSingle implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> personList) {
        List<Person> singleList = new ArrayList<>();
        for (Person p : personList) {
            if (p.getMaritalStatus().equalsIgnoreCase("SINGLE")) {
                singleList.add(p);
            }
        }
        return singleList;
    }
}
